package com.kqkj.dyrule.engine.util;

import com.kqkj.dyrule.engine.beans.EventBean;
import org.apache.flink.api.common.state.ListStateDescriptor;
import org.apache.flink.api.common.state.StateTtlConfig;
import org.apache.flink.api.common.time.Time;

public class StateDescContainer {
    /**
     * 近期状态存储描述器
     */

    public static ListStateDescriptor<EventBean> getEventBeansDesc() {
        ListStateDescriptor<EventBean> eventBeansDesc = new ListStateDescriptor<>("event_beans", EventBean.class);
        StateTtlConfig ttlConfig = StateTtlConfig.newBuilder(Time.hours(2)).build();
        eventBeansDesc.enableTimeToLive(ttlConfig);
        return eventBeansDesc;

    }
}
